import 'package:favorcate/core/viewmodel/favor_view_model.dart';
import 'package:favorcate/ui/shared/size_fit.dart';
import 'package:favorcate/ui/widgets/meal_item.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class JKFavorContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Consumer<JKFavorViewModel>(
      builder: (ctx, favorVM, child) {
        if (favorVM.originMeals.length == 0) {
          return Center(
            child: Text('暂无收藏', style: TextStyle(fontSize: 20.px)),
          );
        }
        return ListView.builder(
          itemBuilder: (itemCtx, index) {
            return JKMealItem(favorVM.originMeals[index]);
          },
          itemCount: favorVM.originMeals.length,
        );
      },
    );
  }
}
